<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * @todo 限制图片上传后缀名和大小
 * @todo 上传图片之后修改图片大小
 */

include ("../conn/conn.php");
$conn = prepare();

$book_id = $_GET['book_id'];
$mingcheng = $_POST['mingcheng'];
$jinjia = $_POST['jinjia'];
$danjia = $_POST['danjia'];
$leixing = $_POST['leixing'];
$shuliang = $_POST['shuliang'];
$author = $_POST['author'];
$jianjie = nl2br($_POST['jianjie']);
$mulu = nl2br($_POST['mulu']);

exectue_sql_statement($conn, 
                      "update Book set book_name='$mingcheng', book_author='$author', purchase_price='$jinjia', unit_price='$danjia', classify_id=$leixing, book_introduction='$jianjie', book_catalog='$mulu' where book_id=$book_id"
                     );
exectue_sql_statement($conn, 
                      "update Store set book_amount=$shuliang where book_id=$book_id"
                     );
echo "<script>alert('图书修改成功!');window.location.href='editbook.php';</script>";
?>